<template>
  <div class="bpl1-bg">
    <div class="co-title">
      <div class="co-title-name">
        <img src="@/assets/cockpit/subdivision/js-text-tdjc.png" alt="" />
      </div>
      <div class="co-title-right">
        <div class="right-text">单位：公顷</div>
      </div>
    </div>
    <div class="detail-content">
      <div class="left">
        <ul class="detail-num">
          <div class="header">
            <div class="lf">指标</div>
            <div class="mid">面积</div>
            <div class="rg">预警状态</div>
          </div>
          <li v-for="(item, index) in listArr" :key="index" :class="item.index === curIndex ? 'active' : ''">
            <div class="style"></div>
            <div class="lf">{{ item.name }}</div>
            <div class="mid">{{ item.area }}</div>
            <div class="rg">
              <img v-if="item.type === 1" src="@/assets/cockpit/subdivision/jc-icon-light-yellow.png" alt="" />
              <img v-if="item.type === 2" src="@/assets/cockpit/subdivision/jc-icon-light-red.png" alt="" />
              <p>{{ item.type === 1 ? '黄色预警' : '红色预警' }}</p>
            </div>
          </li>
          <!-- <li class="active">
            <div class="style"></div>
            <div class="lf">批而未供土地</div>
            <div class="mid">114.53</div>
            <div class="rg">
              <img src="@/assets/cockpit/subdivision/jc-icon-light-red.png" alt="" />
              <p>红色预警</p>
            </div>
          </li> -->

          <!-- <li>
            <div class="style"></div>
            <div class="lf">待撤批地</div>
            <div class="mid">13.04</div>
            <div class="rg">
              <img src="@/assets/cockpit/subdivision/jc-icon-light-yellow.png" alt="" />
              <p>黄色预警</p>
            </div>
          </li>
          <li>
            <div class="style"></div>
            <div class="lf">供而未用土地</div>
            <div class="mid">308.04</div>
            <div class="rg">
              <img src="@/assets/cockpit/subdivision/jc-icon-light-yellow.png" alt="" />
              <p>黄色预警</p>
            </div>
          </li>
          <li>
            <div class="style"></div>
            <div class="lf">闲置土地</div>
            <div class="mid">53.13</div>
            <div class="rg">
              <img src="@/assets/cockpit/subdivision/jc-icon-light-yellow.png" alt="" />
              <p>黄色预警</p>
            </div>
          </li> -->
        </ul>
      </div>
      <div class="mid-line"></div>
      <div class="right">
        <div class="content">
          <div class="bb4-le-sub " :class="curItem.type === 1 ? 'bb4-le-sub3' : 'bb4-le-sub1'">
            <div class="bb4-leb-light"></div>
            <div class="bb4-leb-tri"></div>
            <div class="bb4-leb-word">
              <p>11.73%</p>
              <h6>占批地总规模</h6>
            </div>
          </div>
        </div>
        <div class="text-area">
          <div class="icon" :class="curItem.type === 1 ? 'yellow-icon' : ''"></div>
          <div class="text">{{ curItem.name }}</div>
          <div class="icon" :class="curItem.type === 1 ? 'yellow-icon' : ''"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
// import echarts from 'echarts'

@Component({
  name: 'BuildLandItem6',
  components: {}
})
export default class BuildLandItem6 extends Vue {
  private curIndex = 1
  private listArr = [
    {
      name: '违法用地',
      area: '5313',
      type: 2,
      index: 1
    },
    {
      name: '批而未供土地',
      area: '5313',
      type: 2,
      index: 2
    },
    {
      name: '待撤批地',
      area: '5313',
      type: 1,
      index: 3
    },
    {
      name: '供而未用土地',
      area: '5313',
      type: 1,
      index: 4
    },
    {
      name: '闲置土地',
      area: '5313',
      type: 1,
      index: 5
    }
  ]
  private curItem = {}
  private timer: any = ''
  created() {
    this.timer = setInterval(() => {
      this.curIndex = this.curIndex + 1
      if (this.curIndex > 5) {
        this.curIndex = 1
      }
      this.curItem = this.listArr.filter((q: any) => {
        return q.index === this.curIndex
      })[0]
    }, 1000)
  }
  beforeDestroy() {
    //清除定时器
    clearInterval(this.timer)
  }
  // mounted() {
  //   this.initVillage()
  // }
  // initVillage() {
  //   console.log(echarts, 'echarts')
  //   const myChart = echarts.init(document.getElementById('village') as HTMLElement)
  //   myChart.setOption({
  //     label: {
  //       color: '#ffffff'
  //     },
  //     grid: {
  //       top: '14%',
  //       left: '4%',
  //       right: '4%',
  //       bottom: '3%',
  //       containLabel: true
  //     },
  //     xAxis: {
  //       type: 'category',
  //       data: ['芙蓉区', '开福区', '天心区', '雨花区', '望城区', '长沙县', '浏阳市', '宁乡市'],
  //       //设置网格线颜色
  //       splitLine: {
  //         show: false
  //       },
  //       axisLine: {
  //         lineStyle: {
  //           color: '#254177'
  //         }
  //       },

  //       axisLabel: {
  //         show: true,
  //         textStyle: {
  //           color: '#ffffff', //更改坐标轴文字颜色
  //           fontSize: 12 //更改坐标轴文字大小
  //         }
  //       }
  //     },
  //     yAxis: {
  //       type: 'value',
  //       axisLabel: {
  //         show: true,
  //         textStyle: {
  //           color: '#ffffff', //更改坐标轴文字颜色
  //           fontSize: 12 //更改坐标轴文字大小
  //         }
  //       },
  //       splitLine: {
  //         show: false,
  //         lineStyle: {
  //           color: ['#000000'],
  //           width: 0,
  //           type: 'solid'
  //         }
  //       },
  //       // y轴轴线颜色
  //       axisLine: {
  //         lineStyle: {
  //           color: '#254177'
  //           // width: 1 //这里是坐标轴的宽度
  //         }
  //       }
  //     },
  //     series: [
  //       {
  //         data: [8, 7, 3, 14, 16, 19, 10, 8],
  //         type: 'bar',
  //         barWidth: '18%',
  //         itemStyle: {
  //           color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  //             {
  //               offset: 0,
  //               color: '#6dffd6'
  //             },
  //             {
  //               offset: 1,
  //               color: '#00FFAA'
  //             }
  //           ])
  //         },
  //         showBackground: true,
  //         backgroundStyle: {
  //           color: 'rgba(180, 180, 180, 0.2)'
  //         }
  //       }
  //     ]
  //   })
  // }
}
</script>
<style lang="scss" scoped>
@import '~@/styles/cockpit.scss';
.bpl1-bg {
  width: 100%;
  height: 100%;
  padding: 22px 12px 12px 16px;
  background: url('~@/assets/cockpit/bb-bg.png') no-repeat 0/ 100% 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  // &::before {
  //   content: '';
  //   display: block;
  //   width: 20px;
  //   height: 103%;
  //   background: url('~@/assets/cockpit/bpl-bg-line.png') no-repeat 0/ 100% 100%;
  //   position: absolute;
  //   left: -10px;
  //   top: 50%;
  //   transform: translate(0, -50%);
  // }
  .co-title {
    flex-shrink: 0;
  }
}

.bpl1-table {
  width: 100%;
  .bpl1-tbe {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0px 2px;
    text-align: center;
    .bpl1-tbeh {
      height: 20px;
      background: rgba(#fff, 0.1);
      th {
        font-size: 12px !important;
        line-height: 18px;
        color: #bffeff;
        font-weight: 400;
      }
    }
    .bpl1-tbeb {
      td {
        padding: 4px 4px;
        background: rgba(#fff, 0.05);
        font-size: 16px !important;
        line-height: 20px;
        color: #fff;
        font-weight: 500;
        > span {
          font-size: 12px !important;
          color: #fff;
          font-weight: 400;
        }
      }
      .bpl1-tbeb-title {
        padding: 0 0 0 2px !important;
        background: none;
        border-left: 2px solid #006aff;
        position: relative;
        > p {
          width: 100%;
          height: 100%;
          padding: 4px;
          background: rgba(#fff, 0.05);
          line-height: 20px;
          text-align: center;
          font-size: 12px !important;
          color: #fff;
          font-weight: 400;
        }
      }
    }
  }
}
.bpl1-stac {
  width: 100%;
  display: flex;
  padding: 32px 0 0 22px;
  flex-wrap: wrap;
  .bpl1-st-each {
    flex: none;
    display: flex;
    width: 50%;
    .bpl1-ste-icon {
      flex: none;
      width: 64px;
      height: 64px;
      > img {
        display: block;
        width: 100%;
        height: 100%;
      }
    }
    .bpl1-ste-word {
      flex: none;
      > h6 {
        font-size: 12px !important;
        line-height: 18px;
        color: #bffeff;
        text-align: left;
        font-weight: 400;
        margin: 6px 0 0 0;
      }
      > p {
        font-size: 24px !important;
        line-height: 30px;
        color: #fff;
        text-align: left;
        font-weight: 500;
        margin: 4px 0 0 0;
      }
    }
    .bpl1-ste-chart {
      flex: none;
      width: 64px;
      height: 64px;
      padding: 2px;
      position: relative;
      margin: 0 0 0 12px;
      .bpl1-ste-chart-base {
        width: 100%;
        height: 100%;
      }
      .bpl1-ste-chart-word {
        width: 80%;
        position: absolute;
        left: 10%;
        top: 50%;
        transform: translate(0, -50%);
        > h6 {
          font-size: 16px !important;
          text-shadow: 0 0 4px #00ffaa;
          color: #fff;
          line-height: 20px;
          text-align: center;
        }
        > p {
          font-size: 12px !important;
          line-height: 14px;
          color: #bffeff;
          text-align: center;
        }
      }
    }
  }
  .bpl1-st-line {
    flex: none;
    width: 1px;
    height: 64px;
    background: rgba(#fff, 0.1);
    margin: 0 4px;
  }
}

.com-title-style {
  margin-bottom: 4px;
  margin-top: 16px;
  color: #bffeff;
  display: flex;
  .text {
    margin-top: 6px;
  }
  .title-line {
    width: 40px;
    margin-top: -7px;
    img {
      display: block;
      width: 100%;
    }
  }
}

.detail-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  flex: 1;
  .left {
    flex: 1;
    .detail-num {
      margin-top: 10px;
      .header {
        display: flex;
        font-size: 12px !important;
        color: #bffeff;
        width: 260px;
        height: 25px;
        line-height: 25px;
        background: rgba(255, 255, 255, 0.1);
        .lf {
          flex: 1;
          padding-left: 8px;
        }
        .mid {
          flex: 1;
        }
        .rg {
          flex: 1;
        }
      }
      .active {
        background: rgba(255, 255, 255, 0.2) !important;
        .style {
          position: absolute;
          left: 0;
          top: 0;
          width: 2px;
          height: 24px;
          background: #006aff !important;
          border-right: solid 2px #0e2d68;
          box-sizing: content-box;
        }
      }
      li {
        display: flex;
        justify-content: space-between;
        width: 260px;
        height: 24px;
        line-height: 24px;
        background: rgba(255, 255, 255, 0.1);
        font-size: 12px !important;
        color: #fff;
        position: relative;
        margin-top: 3px;
        .style {
          position: absolute;
          left: 0;
          top: 0;
          width: 2px;
          height: 24px;
          background: #0e2d68;
          border-right: solid 2px #0e2d68;
          box-sizing: content-box;
        }
        .lf {
          flex: 1;
          padding-left: 8px;
        }
        .mid {
          flex: 1;
        }
        .rg {
          flex: 1;
          display: flex;
          img {
            width: 12px;
            height: 12px;
            display: block;
            margin-top: 5px;
            margin-right: 4px;
          }
        }
      }
    }
  }
  .mid-line {
    width: 1px;
    height: 160px;
    background: rgba(255, 255, 255, 0.1);
    margin-left: 8px;
    margin-top: 10px;
    margin-right: 8px;
    flex-shrink: 0;
  }
  .right {
    flex: 1;
    .content {
      margin-top: 10px;
    }
    .text-area {
      font-size: 14px !important;
      line-height: 22px;
      // width: 116px;
      color: #fff;
      margin: auto;
      margin-top: 4px;
      display: flex;
      justify-content: center;
      .text {
        display: inline-block;
      }
      .icon {
        display: inline-block;
        width: 4px;
        height: 4px;
        margin-top: 10px;
        margin-right: 6px;
        margin-left: 6px;
        display: block;
        background: #ff0000;
        border-radius: 1px;
        box-shadow: 0 0 4px 1px #ff0000;
        transform: rotate(45deg);
      }
      .yellow-icon {
        background: #ffcf40 !important;
        box-shadow: 0 0 4px 1px #ffcf40 !important;
      }
    }
  }
}
.right-text {
  font-size: 12px !important;
  color: #dffeff;
  margin-top: 4px;
}
.bb4-le-sub {
  width: 112px;
  height: 138px;
  position: relative;
  margin: 0 auto;
  .bb4-leb-light {
    width: 162px;
    height: 100px;
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translate(-50%, 0);
    z-index: 5;
    animation: bbLight ease 2s infinite;
  }
  .bb4-leb-tri {
    width: 20px;
    height: 10px;
    background: url('~@/assets/cockpit/bb4-leb-tri.png') no-repeat 0/ 100% 100%;
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translate(-50%, 0);
    z-index: 5;
    animation: bbTri ease 2s infinite;
  }

  .bb4-leb-word {
    width: 100%;
    position: absolute;
    left: 0;
    top: 44px;
    z-index: 10;
    > p {
      font-size: 22px !important;
      text-align: center;
      color: #fff;
      text-shadow: 0 0 4px #fff;
    }
    > h6 {
      width: 65%;
      font-size: 12px !important;
      line-height: 16px;
      text-align: center;
      color: #dffeff;
      margin: auto;
      margin-top: 8px;
    }
  }
}
.bb4-le-sub1 {
  background: url('~@/assets/cockpit/subdivision/jc-icon-bg.png') no-repeat 0/ 100% 100%;
  .bb4-leb-light {
    background: url('~@/assets/cockpit/subdivision/jc-icon-ani.png') no-repeat 0/ 100% 100%;
  }
}
.bb4-le-sub3 {
  background: url('~@/assets/cockpit/bb4-le-sub3.png') no-repeat 0/ 100% 100%;
  .bb4-leb-light {
    background: url('~@/assets/cockpit/bb4-leb-light3.png') no-repeat 0/ 100% 100%;
  }
}
@keyframes bbLight {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}
@keyframes bbTri {
  0% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, -5px);
  }
  100% {
    transform: translate(-50%, 0);
  }
}
</style>
